package com.comm.dao.imp;

import com.comm.dao.BaseDAO;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.util.List;
import java.util.Map;

public class BaseDAOImpl extends SqlMapClientDaoSupport implements BaseDAO {

    @Override
    public Object insert(String sqlname, Object parameterObject) {

        return getSqlMapClientTemplate().insert(sqlname, parameterObject);
    }

    @Override
    public Integer delete(String sqlName, Object parameterObject) {
        return getSqlMapClientTemplate().delete(sqlName, parameterObject);
    }

    @Override
    public Integer update(String sqlName, Object parameterObject) {
        // TODO Auto-generated method stub
        return getSqlMapClientTemplate().update(sqlName, parameterObject);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<Object> select(String sqlName, Map<String, Object> paratemObject) {
        // TODO Auto-generated method stub
        return getSqlMapClientTemplate().queryForList(sqlName, paratemObject);
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<Object> select(String sqlName, Object parameterObject) {
        // TODO Auto-generated method stub
        return getSqlMapClientTemplate().queryForList(sqlName, parameterObject);
    }

    @Override
    public Object findBy(String sqlName, Map<String, Object> paratemObject) {
        return getSqlMapClientTemplate().queryForObject(sqlName, paratemObject);
    }

    @Override
    public Object findBy(String sqlName, Object parameterObject) {
        return getSqlMapClientTemplate().queryForObject(sqlName, parameterObject);
    }

//	@Override
//	public Object select(String sqlName, Object parameterObject) {
//		
//		return getSqlMapClientTemplate().queryForObject(sqlName, parameterObject);
//	}

}
